﻿@model ProductModel
@using Nop.Core.Domain.Catalog;
@using Nop.Services
<script>
    $(document).ready(function() {
        $("#@Html.IdFor(model => model.IsRecurring)").click(toggleRecurring);
        toggleRecurring();
    });

    function toggleRecurring() {
        if ($('#@Html.IdFor(model => model.IsRecurring)').is(':checked')) {
            $('#pnlCycleLength').show();
            $('#pnlCyclePeriod').show();
            $('#pnlTotalCycles').show();
        } else {
            $('#pnlCycleLength').hide();
            $('#pnlCyclePeriod').hide();
            $('#pnlTotalCycles').hide();
        }
    }
</script>
<div class="panel-body">
    <div class="form-group">
        <div class="col-md-3">
            <nop-label asp-for="IsRecurring" />
        </div>
        <div class="col-md-9">
            <nop-editor asp-for="IsRecurring" />
            <span asp-validation-for="IsRecurring"></span>
        </div>
    </div>
    <nop-nested-setting asp-for="IsRecurring">
        <div class="form-group" id="pnlCycleLength">
            <div class="col-md-3">
                <nop-label asp-for="RecurringCycleLength" />
            </div>
            <div class="col-md-9">
                <nop-editor asp-for="RecurringCycleLength" />
                <span asp-validation-for="RecurringCycleLength"></span>
            </div>
        </div>
        <div class="form-group" id="pnlCyclePeriod">
            <div class="col-md-3">
                <nop-label asp-for="RecurringCyclePeriodId" />
            </div>
            <div class="col-md-9">
                <nop-select asp-for="RecurringCyclePeriodId" asp-items="@(((RecurringProductCyclePeriod)Model.RecurringCyclePeriodId).ToSelectList())" />
                <span asp-validation-for="RecurringCyclePeriodId"></span>
            </div>
        </div>
        <div class="form-group" id="pnlTotalCycles">
            <div class="col-md-3">
                <nop-label asp-for="RecurringTotalCycles" />
            </div>
            <div class="col-md-9">
                <nop-editor asp-for="RecurringTotalCycles" />
                <span asp-validation-for="RecurringTotalCycles"></span>
            </div>
        </div>
    </nop-nested-setting>
</div>